package asset_handler

import (
	"base"
	"game_server/model"
	"proto/base"
)

type Changes map[interface{}]interface{}

type GetArgs struct {
	ItemId base.AssetItemId
	Entity interface{}
}

type HaveArgs struct {
	ItemId    base.AssetItemId
	ItemCount base.AssetItemCount
	Entity    interface{}
}

type AddArgs struct {
	ItemId    base.AssetItemId
	ItemCount base.AssetItemCount
	Entity    interface{}
	Reason    proto_base.ChangeReason
	Changes   Changes
}

type RemoveArgs struct {
	ItemId    base.AssetItemId
	ItemCount base.AssetItemCount
	Entity    interface{}
	Reason    proto_base.ChangeReason
	Changes   Changes
}

type RollbackArgs struct {
	Changes Changes
}

type ChangeArgs struct {
	Reason proto_base.ChangeReason
}

type Result struct {
	AddItems    []*base.AssetItem
	RemoveItems []*base.AssetItem
}

type Interface interface {
	AssetType() base.AssetType
	GetAsset(player *model.Player, args *GetArgs) (result base.AssetItemCount, err error)
	HaveAsset(player *model.Player, args *HaveArgs) (err error)
	AddAsset(player *model.Player, args *AddArgs) (err error)
	RemoveAsset(player *model.Player, args *RemoveArgs) (err error)
	RollbackAsset(player *model.Player, args *RollbackArgs)
	OnAssetChanged(player *model.Player, args *ChangeArgs)
}
